/**
* @Title: Demo1.java
* @Package me.shibor.study.javaSE.annotation
* @Description: TODO
* @author shibor
* @date 2017年2月20日 上午12:21:44
* @version V1.0
*/
package me.shibor.study.javaSE.annotation;

import java.lang.annotation.Annotation;
import java.lang.reflect.Method;

import me.shibor.study.javaSE.annotation.MyAnnotation.Priority;
import me.shibor.study.javaSE.annotation.MyAnnotation.Status;

/**
 * @ClassName: Demo1
 * @Description: TODO
 * @author shibor
 * @date 2017年2月20日 上午12:21:44
 * 
 */
public class Demo1 {

	public static void main(String[] args){
		
		Class<Demo1> demo1Class = Demo1.class;
		
		for(Method method : demo1Class.getMethods()) {
			
			for(Annotation ano : method.getAnnotations()) {
				String name = ano.annotationType().getName();
				if(name.equals(MyAnnotation.class.getName())) {
					MyAnnotation myAnnotation = (MyAnnotation)method.getAnnotation(MyAnnotation.class);
					if(myAnnotation != null) {
					System.out.println(" Method Name : " + method.getName());
					System.out.println(" Author : " + myAnnotation.author());
					System.out.println(" Priority : " + myAnnotation.priority());
					System.out.println(" Status : " + myAnnotation.status());
					}
				}
				
			}
			
		}
		
	}

	@MyAnnotation(author="shibor", priority=Priority.MEDIUM, status=Status.STARTED)
	public void test() {
		System.out.println("test()...");
	}
}
